package com.zzyl.controller;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.dto.DeviceDataPageReqDto;
import com.zzyl.dto.DevicePageQueryDto;
import com.zzyl.dto.DeviceServiceDataPageQueryDto;
import com.zzyl.entity.DeviceData;
import com.zzyl.service.DeviceDataService;
import com.zzyl.vo.DeviceDataVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/device-data")
@Slf4j
@Api("设备数据相关接口")
public class DeviceDataController {

    @Autowired
    private DeviceDataService deviceDataService;

    /**
     * 获取设备数据分页结果
     * @param deviceDataPageReqDto
     * @return
     */
    @GetMapping("/get-page")
    @ApiOperation("获取设备数据分页结果")
    private ResponseResult<PageResponse<List<DeviceDataVo>>> getDeviceDataPage(DeviceDataPageReqDto deviceDataPageReqDto) {
        log.info("查询设备数据分页条件:{}", deviceDataPageReqDto);
        PageResponse<DeviceDataVo> deviceDataPage = deviceDataService.getDeviceDataPage(deviceDataPageReqDto);
        return ResponseResult.success(deviceDataPage);
    }
}
